package com.example.shw

import android.media.MediaPlayer
import android.os.Bundle
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatActivity
import android.util.Log
import kotlin.math.log

class AlarmTwoAcitvity : AppCompatActivity(){
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.d("12345","闹铃activity")
        val alarmMusic = MediaPlayer.create(this, R.raw.imhappy)
        alarmMusic.isLooping = true
        alarmMusic.start()

        AlertDialog.Builder(this@AlarmTwoAcitvity)
            .setTitle("闹铃")
            .setMessage("闹铃响了，gogogo")
            .setPositiveButton("确定"){ _, _ ->
                alarmMusic.stop()
                this@AlarmTwoAcitvity.finish()
            }.show()
    }
}